/* Copyright (c) 2008 Google Inc.
*  Copyright (c) 2009 Pierre Henri Kuate.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace org.opensocial.data
{
    public enum MediaItemType
    {
        AUDIO,
        IMAGE,
        VIDEO,
    }

    /// <summary> Class representing the media item (video, image, sound).
    /// </summary>
    /// <author>  K
    /// </author>
    public class MediaItem : OpenSocialObject
    {
        /// <summary> Retrieves the OpenSocial ID associated with the instance. Returns an
        /// empty string if no ID has been set.
        /// </summary>
        public string Id
        {
            get { return getStringValue("id"); }
        }

        public string Title
        {
            get { return getStringValue("title"); }
            set { setValue("title", value); }
        }

        public string Caption
        {
            get { return getStringValue("caption"); }
            set { setValue("caption", value); }
        }

        public System.DateTime? Created
        {
            get { return getDateTimeValue("created"); }
        }

        public string ThumbnailUrl
        {
            get { return getStringValue("thumbnailUrl"); }
        }

        public string Description
        {
            get { return getStringValue("description"); }
        }

        public int? Duration
        {
            get { return getIntegerValue("duration"); }
        }

        public Address Location
        {
            get { return singleOrDefaultObjectOfCollection<Address>("location"); }
        }

        public string Language
        {
            get { return getStringValue("language"); }
        }

        public string AlbumId
        {
            get
            {
                return (getStringValue("album_id") == null) ? getStringValue("albumId") : getStringValue("album_id");
            }
        }

        public long? FileSize
        {
            get { return getLongValue("fileSize"); }
        }

        public string StartTime
        {
            get { return getStringValue("startTime"); }
        }

        public int? Rating
        {
            get { return getIntegerValue("rating"); }
        }

        public int? NumVotes
        {
            get { return getIntegerValue("numVotes"); }
        }

        public int? NumComments
        {
            get { return getIntegerValue("numComments"); }
        }

        public int? NumViews
        {
            get { return getIntegerValue("numViews"); }
        }

        public System.Collections.Generic.IList<string> Tags
        {
            get { return getStringValues("tags"); }
        }

        public System.Collections.Generic.IList<string> TaggedPeople
        {
            get { return getStringValues("taggedPeople"); }
        }

        public string MimeType
        {
            get { return getStringValue("mimeType"); }
        }

        public MediaItemType? Type
        {
            get { return getMediaType("type"); }
        }

        public string Url
        {
            get { return getStringValue("url"); }
        }
    }
}